
package mlv.jee.client;


import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;

public class GererParametres extends  TabPanel{

	public GererParametres (){
    // Create a tab panel
    this.setTitle(" Mon compte");
    this.setWidth("400px");

    // Unlike most widgets, animations are disabled by default
    this.getDeckPanel().setAnimationEnabled(true);

    // Add a home tab
    String[] tabTitles = {"Parametres","Reseaux","Notifications","Mobile","Langues","Paiements","Publicites Facebook"};
    //HTML Text1 = new HTML("Parametres",true);
    this.add(gererInfoPerso(), tabTitles[0]);
    // Add a tab with an image
    HTML Text2 = new HTML("<center><img src='images/EnTravaux.png' ></img></center>",true);
    this.add(Text2, tabTitles[1]);

    // Add a tab
    HTML text3 = new HTML("<center><img src='images/EnTravaux.png'></img></center>",true);
    this.add(text3, tabTitles[2]);
   
 // Add a tab
    HTML text4 = new HTML("<center><img src='images/EnTravaux.png' ></img> </center>",true);
    this.add(text4, tabTitles[3]);
    
 // Add a tab
    HTML text5 = new HTML("<center><img src='images/EnTravaux.png' ></img></center>",true);
    this.add(text5, tabTitles[4]);
 // Add a tab
    HTML text6 = new HTML("<center><img src='images/EnTravaux.png' ></img></center>",true);
    this.add(text6, tabTitles[5]);
 // Add a tab
    HTML text7 = new HTML("<center><img src='images/EnTravaux.png'></img></center>",true);
    this.add(text7, tabTitles[6]);
 // Return the content
    this.selectTab(0);
    this.ensureDebugId("cwTabPanel");
    
  }
	
	/**
	   * Create a form that contains undisclosed advanced options.
	   */
	  
	private Widget gererInfoPerso() {
		
		String nom=new String("Nom");
		String prenom=new String("Prenom");
		String email=new String("Email");
		String amis=new String("Amis");
		String amisEtAmis=new String("Amis et leurs amis");
		String toutLeMonde=new String("Tout le monde");
		String personne=new String("Personne");
		String dateDeNaissance=new String("Date De Naissance");
		String password=new String("Mot de Passe");
		String fonction=new String("Fonction");
		String nomForm=new String("Gerer Les informations personnelles");
		final ListBox joursBox = new ListBox();
	    final ListBox moisBox = new ListBox();
	    final ListBox anneesBox = new ListBox();
	    
	    String[] listJours = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
	    String[] listMois={"Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"};
	    String[] listAnnees={"1980","1981","1982","1983","1984","1985","1986","1987","1988","1989","1990"};
	    
	    for (int i = 0; i < listJours.length; i++) {
	    	joursBox.addItem(listJours[i]);
	    }
	    
	    for (int i = 0; i < listMois.length; i++) {
	    	moisBox.addItem(listMois[i]);
	    }
	    
	    for (int i = 0; i < listAnnees.length; i++) {
	    	anneesBox.addItem(listAnnees[i]);
	    }
	    
	    HorizontalPanel hPanel=new HorizontalPanel();
	    hPanel.add(joursBox);
	    hPanel.add(moisBox);
	    hPanel.add(anneesBox);
	    // Create a table to layout the form options
	    FlexTable layout = new FlexTable();
	    layout.setCellSpacing(3);
	    layout.setWidth("800px");
	    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
	    Button valider =new Button();
	    valider.setText("Enregistrer les modifications");
	    valider.setTitle("Valider");
	    // Add a title to the form
	    //layout.setHTML(0, 0,formTitle);
	    //cellFormatter.setColSpan(0, 0, 2);
	    cellFormatter.setHorizontalAlignment(0, 0,HasHorizontalAlignment.ALIGN_CENTER);

	   
	    // Create some advanced options
	    
	    
	    Grid advancedOptions = new Grid(8, 6);
	    advancedOptions.setBorderWidth(0);
	    advancedOptions.setCellSpacing(6);
	    
	    advancedOptions.setHTML(0, 0, null);
	    advancedOptions.setHTML(0, 1, null);
	    advancedOptions.setHTML(0, 2, amis);
	    advancedOptions.setHTML(0, 3, amisEtAmis);
	    advancedOptions.setHTML(0, 4, toutLeMonde);
	    advancedOptions.setHTML(0, 5, personne);
	    
	    advancedOptions.setHTML(1, 0, nom);
	    advancedOptions.setWidget(1, 1, new TextBox());
	    advancedOptions.setWidget(1, 2, new RadioButton(""));
	    advancedOptions.setWidget(1, 3, new RadioButton(""));
	    advancedOptions.setWidget(1, 4, new RadioButton(""));
	    advancedOptions.setWidget(1, 5, new RadioButton(""));
	    
	    advancedOptions.setHTML(2, 0, prenom);
	    advancedOptions.setWidget(2, 1, new TextBox());
	    advancedOptions.setWidget(2, 2, new RadioButton(""));
	    advancedOptions.setWidget(2, 3, new RadioButton(""));
	    advancedOptions.setWidget(2, 4, new RadioButton(""));
	    advancedOptions.setWidget(2, 5, new RadioButton(""));
	    
	    advancedOptions.setHTML(3, 0, dateDeNaissance);
	    advancedOptions.setWidget(3, 1, hPanel);
	    advancedOptions.setWidget(3, 2, new RadioButton(""));
	    advancedOptions.setWidget(3, 3, new RadioButton(""));
	    advancedOptions.setWidget(3, 4, new RadioButton(""));
	    advancedOptions.setWidget(3, 5, new RadioButton("")); 
	    
	    advancedOptions.setHTML(4, 0, email);
	    advancedOptions.setWidget(4, 1, new TextBox());
	    advancedOptions.setWidget(4, 2, new RadioButton(""));
	    advancedOptions.setWidget(4, 3, new RadioButton(""));
	    advancedOptions.setWidget(4, 4, new RadioButton(""));
	    advancedOptions.setWidget(4, 5, new RadioButton(""));
	    
	    advancedOptions.setHTML(5, 0, password);
	    PasswordTextBox passwordTextBox1=new PasswordTextBox();
	    advancedOptions.setWidget(5, 1, passwordTextBox1);
	    
		advancedOptions.setWidget(5, 3, null);
	    advancedOptions.setWidget(5, 4, null);
	    advancedOptions.setWidget(5, 5, null);
	    
	    advancedOptions.setHTML(6, 0, fonction);
	    advancedOptions.setWidget(6, 1, new TextBox());
	    advancedOptions.setWidget(6, 2, new RadioButton(""));
	    advancedOptions.setWidget(6, 3, new RadioButton(""));
	    advancedOptions.setWidget(6, 4, new RadioButton(""));
	    advancedOptions.setWidget(6, 5, new RadioButton(""));
	    	    
	    advancedOptions.setHTML(7, 0, null);
	    advancedOptions.setWidget(7, 1, valider);
	    advancedOptions.setWidget(7, 2, null);
	    advancedOptions.setWidget(7, 3, null);
	    advancedOptions.setWidget(7, 4, null);
	    advancedOptions.setWidget(7, 5, null);
	    
	    // Add advanced options to form in a disclosure panel
	    DisclosurePanel advancedDisclosure = new DisclosurePanel(nomForm);
	    advancedDisclosure.setAnimationEnabled(true);
	    advancedDisclosure.ensureDebugId("cwDisclosurePanel");
	    advancedDisclosure.setContent(advancedOptions);
	    layout.setWidget(3, 0, advancedDisclosure);
	    cellFormatter.setColSpan(3, 0, 2);

	    // Wrap the contents in a DecoratorPanel
	    DecoratorPanel decPanel = new DecoratorPanel();
	    decPanel.setWidget(layout);
	    return decPanel;
	  }
	
	private Widget gererApplications() {
		FlexTable layout = new FlexTable();
		DecoratorPanel decPanel = new DecoratorPanel();
	    decPanel.setWidget(layout);
	    return decPanel;
	}
	
	private Widget gererAmis() {
		FlexTable layout = new FlexTable();
		DecoratorPanel decPanel = new DecoratorPanel();
	    decPanel.setWidget(layout);
	    return decPanel;
	}
	
	private Widget gererAlbums() {
		FlexTable layout = new FlexTable();
		DecoratorPanel decPanel = new DecoratorPanel();
	    decPanel.setWidget(layout);
	    return decPanel;
	}
}